<template>
  <el-dialog class="auto-detection"
             :visible.sync="alertInfo.alert">

    <span>

      <i18n path="main.checkIntegration"
            tag="span"
            >
        <strong place="name" style="font-size:16px">{{alertInfo.name}}</strong>
      </i18n>
    </span>

    <template slot="footer">

      <el-button type="primary"
                 size="small"
                 @click="alertInfo.alert = false">{{$t('ok')}}</el-button>
    </template>
  </el-dialog>
</template>

<script>
export default {
  name: 'AutoDetection',

  data () {
    return {
      checkLoading: false,
      alertInfo: {
        name: '',
        alert: false
      }
    }
  },

  created () {
    //this.checkIntegration()
  },

  methods: {
    async checkIntegration () {
      try {
        this.checkLoading = true
        const { get } = this._
        const { alertIntegration } = this.$interface.taskManager

        let { data: response } = await alertIntegration()

        if (response.code !== 0) {
          throw get(response, 'msg', '')
        }

        this.alertInfo.name = get(response, 'data.name')
        this.alertInfo.alert = get(response, 'data.alert', false)
      } catch (error) {

      } finally {
        this.checkLoading = false
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.auto-detection {
}
</style>
